package com.ianmoone.JZOF;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class XCTest2 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.nextLine();
		int time = in.nextInt();
		List<Integer> list = new ArrayList<>();
		in.nextLine();
		for (int i = 0; i < n; i++) {
			String string = in.nextLine();
			String[] split = string.split(" ");
			int num = Integer.valueOf(split[0]);
			int start = Integer.valueOf(split[1]);
			int end = Integer.valueOf(split[2]);
			if (start<=time&&time<=end) {
				list.add(num);
			}
		}
		list.sort(null);
		if (list.size()==0) {
			System.out.println("null");
		}else{
			for(int z : list){
				System.out.println(z);
			}
		}
	}
}
